def make_multiplier_of(n):
    def multiplier(x):
        return x * n

    return multiplier  # 闭包


def m():
    m4 = make_multiplier_of(4)  # 返回函数签名方便后面使用
    print(type(m4), m4(2))
    m5 = make_multiplier_of(5)
    print(type(m5), m5(2))


def change(a):
    def w(b):
        def x(c):
            def y(d):
                def z(e):
                    print(a, b, c, d, e)

                return z

            return y

        return x

    return w


def curry():  # 柯里化
    one = change(1)
    print(type(one), one)
    two = one(2)
    print(type(two), two)
    three = two(3)
    print(type(three), three)
    four = three(4)
    print(type(four), four)
    four(5)
    # 调用步骤合并
    change(1)(2)(3)(4)(5)


if __name__ == '__main__':
    m()
    curry()
